<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">


  
  
    
    
  <script src="/answer1225.gitee.io/lib/pace/pace.min.js?v=1.0.2"></script>
  <link href="/answer1225.gitee.io/lib/pace/pace-theme-minimal.min.css?v=1.0.2" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/answer1225.gitee.io/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/answer1225.gitee.io/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/answer1225.gitee.io/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/answer1225.gitee.io/images/favicon.ico?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/answer1225.gitee.io/images/favicon.ico?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/answer1225.gitee.io/images/favicon.ico?v=5.1.4">


  <link rel="mask-icon" href="/answer1225.gitee.io/images/favicon.ico?v=5.1.4" color="#222">





  <meta name="keywords" content="PHP,">










<meta name="description" content="最近在做一个支付接口，需求是这样的：先处理自己需要的数据，存到数据库，然后再将第三方支付接口需要的数据以post的形式传过去。讲这个代码分享一下。 echo &amp;quot;&amp;lt;form style=&amp;apos;display:none;&amp;apos; id=&amp;apos;form&amp;apos; name=&amp;apos;form&amp;apos; method=&amp;apos;post&amp;apos; action=&amp;">
<meta name="keywords" content="PHP">
<meta property="og:type" content="article">
<meta property="og:title" content="利用PHP实现跳转页面的同时POST传参">
<meta property="og:url" content="https://answer1225.gitee.io/answer1225.gitee.io/2018/03/24/php-form-post/index.html">
<meta property="og:site_name" content="PENN GO">
<meta property="og:description" content="最近在做一个支付接口，需求是这样的：先处理自己需要的数据，存到数据库，然后再将第三方支付接口需要的数据以post的形式传过去。讲这个代码分享一下。 echo &amp;quot;&amp;lt;form style=&amp;apos;display:none;&amp;apos; id=&amp;apos;form&amp;apos; name=&amp;apos;form&amp;apos; method=&amp;apos;post&amp;apos; action=&amp;">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2018-11-06T08:44:53.897Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="利用PHP实现跳转页面的同时POST传参">
<meta name="twitter:description" content="最近在做一个支付接口，需求是这样的：先处理自己需要的数据，存到数据库，然后再将第三方支付接口需要的数据以post的形式传过去。讲这个代码分享一下。 echo &amp;quot;&amp;lt;form style=&amp;apos;display:none;&amp;apos; id=&amp;apos;form&amp;apos; name=&amp;apos;form&amp;apos; method=&amp;apos;post&amp;apos; action=&amp;">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/answer1225.gitee.io/',
    scheme: 'Mist',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: 'OSM6R8R4MF',
      apiKey: '5d5ed60c284870677ff3101e71c29977',
      indexName: 'Hexo Blog',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"未发现与 「${query}」相关的内容","hits_stats":"${hits} 条相关条目，使用了 ${time} 毫秒"}
    }
  };
</script>



  <link rel="canonical" href="https://answer1225.gitee.io/answer1225.gitee.io/2018/03/24/php-form-post/">





  <title>利用PHP实现跳转页面的同时POST传参 | PENN GO</title>
  








</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/answer1225.gitee.io/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">PENN GO</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <h1 class="site-subtitle" itemprop="description">PENN GO</h1>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/answer1225.gitee.io/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/answer1225.gitee.io/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/answer1225.gitee.io/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/answer1225.gitee.io/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/answer1225.gitee.io/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  
  <div class="algolia-popup popup search-popup">
    <div class="algolia-search">
      <div class="algolia-search-input-icon">
        <i class="fa fa-search"></i>
      </div>
      <div class="algolia-search-input" id="algolia-search-input"></div>
    </div>

    <div class="algolia-results">
      <div id="algolia-stats"></div>
      <div id="algolia-hits"></div>
      <div id="algolia-pagination" class="algolia-pagination"></div>
    </div>

    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
  </div>




    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://answer1225.gitee.io/answer1225.gitee.io/answer1225.gitee.io/2018/03/24/php-form-post/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Penn Liu">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="http://p5obw8gcx.bkt.clouddn.com/blog%E5%A4%B4%E5%83%8F">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="PENN GO">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">利用PHP实现跳转页面的同时POST传参</h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-03-24T00:00:00+08:00">
                2018-03-24
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
                  <a href="/answer1225.gitee.io/categories/PHP/" itemprop="url" rel="index">
                    <span itemprop="name">PHP</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          
            <div class="post-wordcount">
              
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">字数统计&#58;</span>
                
                <span title="字数统计">
                  157
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">
                  1
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">
      
      
      

      
        <p>最近在做一个支付接口，需求是这样的：先处理自己需要的数据，存到数据库，然后再将第三方支付接口需要的数据以post的形式传过去。<br>讲这个代码分享一下。</p>
<pre><code>echo &quot;&lt;form style=&apos;display:none;&apos; id=&apos;form&apos; name=&apos;form&apos; method=&apos;post&apos; action=&apos;你要跳转的地址&apos;&gt;
          &lt;input name=&apos;version&apos; type=&apos;text&apos; value=&apos;{$param[&quot;version&quot;]}&apos; /&gt;
          &lt;input name=&apos;orderId&apos; type=&apos;text&apos; value=&apos;{$orderId}&apos;/&gt;
      &lt;/form&gt;
      &lt;!-- 自动提交submit --&gt;
      &lt;script type=&apos;text/javascript&apos;&gt;function load_submit(){document.form.submit()}load_submit();&lt;/script&gt;&quot;;
</code></pre>
      
    </div>
    
    
    

    
      <div>
        <div id="wechat_subscriber" style="display: block; padding: 10px 0; margin: 20px auto; width: 100%; text-align: center">
    <img id="wechat_subscriber_qcode" src="http://p5obw8gcx.bkt.clouddn.com/qrcode_for_gh_746beaeb2d2c_258.jpg" alt="Penn Liu wechat" style="width: 200px; max-width: 100%;">
    <div>扫描二维码，关注公众号~</div>
</div>

      </div>
    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>你的鼓励是我前行路上的一点激励，谢谢~</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="http://p5obw8gcx.bkt.clouddn.com/wechatpay.png" alt="Penn Liu 微信支付">
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="http://p5obw8gcx.bkt.clouddn.com/alipay.jpg" alt="Penn Liu 支付宝">
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    <div>
      
        <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    
</div>
      
    </div>

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/answer1225.gitee.io/tags/PHP/" rel="tag"><i class="fa fa-tag"></i> PHP</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/answer1225.gitee.io/2018/03/22/js-timeToDatetime/" rel="next" title="JS时间戳转日期">
                <i class="fa fa-chevron-left"></i> JS时间戳转日期
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/answer1225.gitee.io/2018/03/25/ss代理/" rel="prev" title="阿里云海外服务器搭建SS代理">
                阿里云海外服务器搭建SS代理 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      

      <section class="site-overview-wrap sidebar-panel sidebar-panel-active">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="http://p5obw8gcx.bkt.clouddn.com/blog%E5%A4%B4%E5%83%8F" alt="Penn Liu">
            
              <p class="site-author-name" itemprop="name">Penn Liu</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/answer1225.gitee.io/archives">
              
                  <span class="site-state-item-count">6</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/answer1225.gitee.io/categories/index.html">
                  <span class="site-state-item-count">3</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/answer1225.gitee.io/tags/index.html">
                  <span class="site-state-item-count">4</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/yourname" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="penn5573@gmail.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://www.jianshu.com/u/08ccde3a1d3a" target="_blank" title="简书">
                      
                        <i class="fa fa-fw fa-heartbeat"></i>简书</a>
                  </span>
                
            </div>
          

          
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                友情链接
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="https://blog.qiuxiaochao.com/" title="仇小超" target="_blank">仇小超</a>
                  </li>
                
              </ul>
            </div>
          

          

        </div>
      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<div class="copyright">&copy; 2015 &mdash; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Penn Liu</span>

  
</div>


  <div class="powered-by">
    <i class="fa fa-user-md"></i>
    <span id="busuanzi_container_site_pv">本站总访问量<span id="busuanzi_value_site_pv"></span>次</span>
  </div>

  <!-- 
    <span class="post-meta-divider">|</span>
  

  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div> -->


<!-- 
  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.1.4</div>


 -->


  <span class="post-meta-divider">|</span>


<div class="theme-info">
  <div class="powered-by"></div>
  <span class="post-count">博客全站共1.4k字</span>
</div>

        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/answer1225.gitee.io/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/answer1225.gitee.io/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/answer1225.gitee.io/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/answer1225.gitee.io/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/answer1225.gitee.io/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/answer1225.gitee.io/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/answer1225.gitee.io/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/answer1225.gitee.io/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/answer1225.gitee.io/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/answer1225.gitee.io/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/answer1225.gitee.io/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  




  
  
  
  <link rel="stylesheet" href="/answer1225.gitee.io/lib/algolia-instant-search/instantsearch.min.css">

  
  
  <script src="/answer1225.gitee.io/lib/algolia-instant-search/instantsearch.min.js"></script>
  

  <script src="/answer1225.gitee.io/js/src/algolia-search.js?v=5.1.4"></script>



  

  

  

  
  

  

  

  

</body>
</html>
